<?php

class my_fav extends a_front_controller {

    protected $srv;

    public function __construct() {
        parent::__construct();
        $this->srv = new service_l_favorite();
        $this->load->library("json");
    }

    public function add_del_fav_item() {
        $pid = $this->input->post("fav_prod_id");
        $lid = $this->input->post("fav_list_id");
        $op = $this->input->post("op");
        $return = false;
        if ($op === "add") {
            $return = $this->srv->add_item($lid, $pid);
        } elseif ($op === "del") {
            $return = $this->srv->remove_item($lid, $pid);
        }
        return $return;
    }

    public function fav_entry_exists(){
        $pid = $this->input->post("fav_prod_id");
        $lid = $this->input->post("fav_list_id");
        return is_valid_fav_entry($lid, $pid)===TRUE ? "\"y\"" : "\"n\"";
    }
    public function batch_assign() {
        
    }

    public function index(){
        
    }

}

?>